package com.kyzh.core.dialog

import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import androidx.appcompat.app.AlertDialog
import com.kyzh.core.R
import com.kyzh.core.databinding.DialogSignOpenVipBinding


private var signOpenVipDialog:AlertDialog?=null

fun Activity.showSignOpenVipDialog(listener:()->Unit){
    signOpenVipDialog = AlertDialog.Builder(this, R.style.kyzhGuestLoginDialog)
            .setView(getView(listener))
            .create()

    signOpenVipDialog?.show()
}
private fun Activity.getView(listener:()->Unit):View{
    val binding = DialogSignOpenVipBinding.bind(LayoutInflater.from(this).inflate(R.layout.dialog_sign_open_vip,null,false))
    binding.tvSign.setOnClickListener {
        listener()
        signOpenVipDialog?.dismiss()

    }
    binding.cancel.setOnClickListener {
        signOpenVipDialog?.dismiss()
    }
    return binding.root
}